$.namespace=function(name,value){if(value==undefined){names=name.split(".");for(i=0;i<names.length;i++){var o="window";var o2=window;for(j=0;j<i+1;j++){o=o+"."+names[j]}if(eval(o)==undefined)eval(o+"= {}")};return eval(name)}};

$(function(){
	$(".callmodal").click(function(){
		var $this = $(this);
		
		if($this.data("oninit") != undefined && !$this.data("oninit")()){
			return false;
		};
		
		top.$.namespace("bowos.modal")({
			src: $this.attr("href"),
			callback:function(o){
				if($this.data("callback") != undefined){
					$this.data("callback")(o);
				};
			},
			onload:$(this).data("onload"),
			$target : $this
		});
		$this.data("returns", function(o){
			if($this.data("callback") != undefined){
				$this.data("callback")(o);
			};
		});
		return false;
	});
});